%section#log
  %aside#log_panel
    Found
    = @message_count
    results.

    - if @message_count > @limit
      %span.pagination
        Pages:
        - 1.upto(@message_count / @limit + 1) do |page|
          - if page == (params[:page] || 1).to_i
            %span.current= page
          - else
            %a{href: channel_url(@channel, "search?q=#{params[:q]}&page=#{page}")}= page


  - if params[:q].length < 3
    Enter at least three letters as a keyword.
  - elsif @messages.nil? || @messages.empty?
    No messages are found.
  - else
    %div{class: "log-messages with-panel"}
      - current_date = nil
      - @messages.each do |message|
        - message_date = Time.at(message.timestamp).gmtime.strftime("%Y-%m-%d")
        - if current_date != message_date
          - current_date = message_date
          %h4= current_date
        = haml :_message, locals: { message: message, mode: :search }

